﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DacSanMienTayOBJ;
public partial class UserControl_ManagerAdvertisingPosition : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
    }
    private void InsertAdvPosition()
    {
        try
        {
            string advName = Request["txtAdvName"];
            if (advName == "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Vui lòng nhập tên vị trí')", true);
            }
            else
            {
                AdvPosition adv = new AdvPosition();
                adv.AdvPoName = advName;
                adv.IsVisible = 1;
                bool rs = AdvPositionBusiness.InsertAdvPosition(adv, ConnectionType.AdminConnection);
                if (rs)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Đã thêm xong')", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Không thêm được. Vui lòng liên hệ admin')", true);
                }
            }
        }
        catch(Exception ex)
        {
            Utilitys.WriteLog(ex.Message);
        }
    }
    protected void cmdInsert_Click(object sender, EventArgs e)
    {
        InsertAdvPosition();
    }
}